package com.scommunity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sc_pay")
public class Pay implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.ASSIGN_ID)
    private Long payId;
    private String payNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime payTime;
    private Long ownerId;
    private BigDecimal payMoney;
    private String payType;
    private String payStatus;
    private String payWay;
    private String payMark;
    @TableField(exist = false)
    private Owner owner;
    
    public Pay(Pay pay) {
        if (Objects.nonNull(pay)) {
            this.payId=pay.payId;
            this.payNum=pay.payNum;
            this.payTime=pay.payTime;
            this.ownerId=pay.ownerId;
            this.payMoney=pay.payMoney;
            this.payType=pay.payType;
            this.payStatus=pay.payStatus;
            this.payWay=pay.payWay;
            this.payMark=pay.payMark;
            this.owner= pay.owner;
        }
    }
}
